<style>
    .dashboard{
        display: flex;
        justify-content: center;
        position: inherit;
        top: 0;
        left: 0;
        width: 100%;
    }
    .dashboard>div{
        padding: 0 10px;
    }
    .dashboard>div>lable:last-child{
        color: red;
    }
</style>
<div class="dashboard" data-api="{:U($CONTROLLER_NAME.'/api')}">
    <div><lable> 形式1（四条减免1000元）配额使用情况 </lable> <lable></lable></div>
    <div><lable> 总配额:</lable> <lable data-quota2="0">{$dashboard.quota2}</lable></div>
    <div><lable> 已用配额:</lable> <lable data-used2="0">{$dashboard.used2}</lable></div>
    <div><lable> 剩余配额:</lable> <lable data-remain2="0">{$dashboard['quota2']-$dashboard['used2']}</lable></div><br/>
    <div><lable> 通过审核数量:</lable> <lable data-passed2="0">{$dashboard['passed2']}</lable></div>
    <div><lable> 累计金额:</lable> ￥<lable data-price="0">{$dashboard['passed2']*1000}</lable></div>
</div>
<div class="dashboard" data-api="{:U($CONTROLLER_NAME.'/api')}">
    <div><lable> 形式2（二条减免350元）配额使用情况 </lable> <lable></lable></div>
    <div><lable> 总配额:</lable> <lable data-quota3="0">{$dashboard['quota'] - $dashboard['quota2']}</lable></div>
    <div><lable> 已用配额:</lable> <lable data-used3="0">{$dashboard['used']-$dashboard['used2']}</lable></div>
    <div><lable> 剩余配额:</lable> <lable data-remain3="0">{$dashboard['quota'] - $dashboard['used'] - $dashboard['quota2']+$dashboard['used2']}</lable></div>
    <div><lable> 通过审核数量:</lable> <lable data-passed3="0">{$dashboard['passed3']}</lable></div>
    <div><lable> 累计金额:</lable> ￥<lable data-price="0">{$dashboard['used']*350-$dashboard['used2']*350}</lable></div>
</div>
<script>
    $(function(){
        var $dashboard = $(".dashboard"), $inter, $data, $url = $dashboard.data("api"), $callback, $flush ;
        $data = {action: "getQuota",uid: {:session('user_auth.uid')}};
        $callback = function($res){
            if ( $res.status ==1 ){
                $(".dashboard [data-quota]").text($res.data.quota);
                $(".dashboard [data-used]").text($res.data.used);
                $(".dashboard [data-remain]").text($res.data.quota-$res.data.used);
                $(".dashboard [data-price]").text($res.data.price);
            }
        };
        
//        $inter = setInterval(function(){
//            // 通过api获取最新的配额信息,通过回调函数更新显示
//            send_data($data, $url, $callback);
//        },10000);
    });
</script>
